package org.thread.Homework04;/*
 *@Author: gjh
 *Date: 2025/3/12 8:09
 *Describe:
 */

public class MyRunnable implements Runnable{
    private String name;

    public MyRunnable(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        int num = 0;
        boolean flag = true;
        while (flag){
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            flag =  MainTest.mainTest.sellFilmNum();
            System.out.println("电影"+getName()+"已卖电影票"+num++);
        }
    }
}
